package cn.com.websocket.enums;

/***
 ** @category 请用一句话描述这个类的用途
 ** @author qing.yunhui
 ** @email: qingyh@glodon.com
 ** @createTime: 2021-08-18 11:34
 **/
public class MessageEnum {

    /**
     * <p>(0:文本，1:附件，2:语音)</p>
     * */
    public enum MSG_TYPE implements ICommonEnum{
        TEXT("0","文本"),
        ATTACHMENT("1","附件"),
        VOICE("2","语音");
        private final String code;
        private final String value;
        MSG_TYPE(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() { return code; }
        public String getValue() { return value; }
        @Override
        public Integer getKey() { return Integer.parseInt(code); }
    }

    /**
     * <p>消息策略</p>
     * */
    public enum MSG_STRATEGY implements ICommonEnum{
        ONLINE_OFFLINE("0","onlineOfflineMsgService","在线或离线消息"),
        HISTORY("1","historyMsgService","历史消息"),
        ACK("2","ackMsgService","消息确认接收");
        private final String code;
        private final String value;
        private final String beanName;
        MSG_STRATEGY(String code,String beanName,String value) {
            this.code = code;
            this.beanName=beanName;
            this.value = value;
        }
        public String getCode() { return code; }
        public String getValue() { return value; }
        @Override
        public Integer getKey() { return Integer.parseInt(code); }
        public String getBeanName() { return beanName; }
    }

    /**
     * <p>策略标志</p>
     * */
    public enum STRATEGY implements ICommonEnum{
        HISTORY("history",MSG_STRATEGY.HISTORY.getCode()),
        ACK("ack",MSG_STRATEGY.ACK.getCode());
        private final String code;
        private final String value;
        STRATEGY(String code,String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() { return code; }
        public String getValue() { return value; }
        @Override
        public Integer getKey() { return null; }
    }

}
